Source for file SC_GraphPie.php
Documentation is available at SC_GraphPie.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once $ownDir . 'SC_GraphBase.php';
function SC_GraphPie($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = PIE_LEFT, $top = PIE_TOP) {
parent::SC_GraphBase($bgw, $bgh, $left, $top);
$this->setPosition($this->left + ($this->cw / 2), $this->top + ($this->ch / 2));
foreach($array as $val) {
foreach($array as $val) {
$ret = round($val * $rate);
$arrRet[0] -= $new_total - 360;
function setSize($cw, $ch, $cz = 0) {
imagefilledarc($this->image, $this->cx + $move, $i, $this->cw, $this->ch, 0, 360, $this->shade_color, IMG_ARC_PIE);
$rd_max = count($arrRad);
$c_max = count($this->arrColor);
$dc_max = count($this->arrDarkColor);
for ($i = ($y + $z - 1); $i >= $y; $i-- ) {
for($j = 0; $j < $rd_max; $j++ ) {
$end = $start + $arrRad[$j];
if($start == 0 && $end == 360) {
// -90~270で指定すると円が描画できないので0~360に指定
imagearc($this->image, $x, $i, $w, $h, 0, 360, $this->arrDarkColor[($j % $dc_max)]);
// -90°は12時の位置から開始するように補正している
imagearc($this->image, $x, $i, $w, $h, $start - 90, $end - 90, $this->arrDarkColor[($j % $dc_max)]);
imagearc($this->image, $x, $y + $z, $w, $h, 0, 180 , $this->flame_color);
for($i = 0; $i < $rd_max; $i++ ) {
$end = $start + $arrRad[$i];
if($start == 0 && $end == 360) {
// -90~270で指定すると円が描画できないので0~360に指定
imagefilledarc($this->image, $x, $y, $w, $h, 0, 360, $this->arrColor[($i % $c_max)], IMG_ARC_PIE);
// -90°は12時の位置から開始するように補正している。
imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->arrColor[($i % $c_max)], IMG_ARC_PIE);
for($i = 0; $i < $rd_max; $i++ ) {
$end = $start + $arrRad[$i];
if($start == 0 && $end == 360) {
// -90~270で指定すると円が描画できないので0~360に指定
imagearc($this->image, $x, $y, $w, $h, 0, 360 , $this->flame_color);
// -90°は12時の位置から開始するように補正している。
imagefilledarc($this->image, $x, $y, $w, $h, $start - 90, $end - 90, $this->flame_color, IMG_ARC_EDGED| IMG_ARC_NOFILL);
imageline($this->image, $x + ($w / 2), $y, $x + ($w / 2), $y + $z, $this->flame_color);
imageline($this->image, $x - ($w / 2), $y, $x - ($w / 2), $y + $z, $this->flame_color);
for($i = 0; $i < $rd_max; $i++ ) {
$end = $start + $arrRad[$i];
if($end > 90 && $end < 270) {
list ($ax, $ay) = $this->lfGetArcPos($x, $y, $w, $h, $end);
imageline($this->image, $ax, $ay, $ax, $ay + $z, $this->flame_color);
$rd_max = count($arrRad);
for($i = 0; $i < $rd_max; $i++ ) {
$center = $start + ($arrRad[$i] / 2);
$end = $start + $arrRad[$i];
list ($sx, $sy) = $this->lfGetArcPos($this->cx, $this->cy, ($this->cw / 1.5), ($this->ch / 1.5), $center);
list ($ex, $ey) = $this->lfGetArcPos($this->cx, $this->cy, ($this->cw * 1.5), ($this->ch * 1.5), $center);
imageline($this->image, $sx, $sy, $ex + 2, $ey - PIE_LABEL_UP, $this->flame_color);
Documentation generated on Fri, 24 Feb 2012 14:02:38 +0900 by Seasoft
|